let path = require('path');
let childProcess = require('child-process-debug');
let debugUtils = require('./utils/debugUtils');

let cmdFile = path.resolve(__dirname, './index_speed.js');

let cpuCount = 1;
// let offset = 500 * 10000;
let startPos = 1700 * 10000;
let offset = 100 * 10000;

// for (let i = 0; i < cpuCount; i++) {
//
//     let execArgv = [];
//
//     if (debugUtils.isDebuggingNotCheckPort()) {
//         execArgv.push(debugUtils.DEBUG_BRK);
//     }
//     let process = childProcess.fork(cmdFile, [offset * i, offset], {execArgv: execArgv});
//
//     process.on('close', function () {
//         console.log('close');
//     });
//     process.on('uncaughtException', function (err) {
//         console.error('An uncaught error occurred!');
//         process = null;
//     });
// }
let execArgv = [];

if (debugUtils.isDebuggingNotCheckPort()) {
    execArgv.push(debugUtils.DEBUG_BRK);
}
let process = childProcess.fork(cmdFile, [startPos, offset], {execArgv: execArgv});

process.on('close', function () {
    console.log('close');
});
process.on('uncaughtException', function (err) {
    console.error('An uncaught error occurred!');
    process = null;
});
